package cn.lanqiao.ui;

import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableModel;

public class MainFrame extends JFrame {


	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
	private JTable table;
	
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MainFrame frame = new MainFrame();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	
	public MainFrame() {
		setResizable(false);
		setFont(new Font("微软雅黑", Font.PLAIN, 14));
		setTitle("背单词");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 573, 456);
		
		JMenuBar menuBar = new JMenuBar();
		menuBar.setForeground(Color.WHITE);
		menuBar.setEnabled(false);
		menuBar.setBorderPainted(false);
		setJMenuBar(menuBar);
		
		JMenu menu = new JMenu("菜单");
		menu.setFont(new Font("黑体", Font.PLAIN, 14));
		menuBar.add(menu);
		
		JMenuItem menuItem = new JMenuItem("复习当日");
		menuItem.setFont(new Font("微软雅黑", Font.PLAIN, 14));
		menu.add(menuItem);
		
		JMenuItem menuItem_1 = new JMenuItem("复习以前");
		menuItem_1.setFont(new Font("微软雅黑", Font.PLAIN, 14));
		menu.add(menuItem_1);
		
		JMenuItem menuItem_2 = new JMenuItem("模糊词");
		menuItem_2.setFont(new Font("微软雅黑", Font.PLAIN, 14));
		menu.add(menuItem_2);
		
		JMenuItem menuItem_3 = new JMenuItem("换一组");
		menuItem_3.setFont(new Font("微软雅黑", Font.PLAIN, 14));
		menu.add(menuItem_3);
		
		JMenuItem menuItem_4 = new JMenuItem("退出");
		menuItem_4.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.exit(0);
			}
		});
		menuItem_4.setFont(new Font("黑体", Font.PLAIN, 14));
		menu.add(menuItem_4);
		
		JMenu menu_1 = new JMenu("帮助");
		menu_1.setFont(new Font("黑体", Font.PLAIN, 14));
		menuBar.add(menu_1);
		
		JMenuItem menuItem_5 = new JMenuItem("关于我们");
		menuItem_5.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				AboutWe about = new AboutWe();
				about.setVisible(true);
			}
		});
		menuItem_5.setFont(new Font("微软雅黑", Font.PLAIN, 14));
		menu_1.add(menuItem_5);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JButton button = new JButton("复习当日");
		button.setFont(new Font("微软雅黑", Font.PLAIN, 14));
		button.setBounds(10, 353, 93, 46);
		contentPane.add(button);
		
		JButton button_1 = new JButton("复习以前");
		button_1.setFont(new Font("微软雅黑", Font.PLAIN, 14));
		button_1.setBounds(161, 353, 93, 46);
		contentPane.add(button_1);
		
		JButton button_2 = new JButton("模糊词");
		button_2.setFont(new Font("微软雅黑", Font.PLAIN, 14));
		button_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		button_2.setBounds(316, 353, 93, 46);
		contentPane.add(button_2);
		
		JButton button_3 = new JButton("换一组");
		button_3.setFont(new Font("微软雅黑", Font.PLAIN, 14));
		button_3.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		button_3.setBounds(464, 353, 93, 46);
		contentPane.add(button_3);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(0, 0, 569, 343);
		contentPane.add(scrollPane);
		
		table = new JTable();
		table.setModel(new DefaultTableModel(
			new Object[][] {
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
				{null, null},
			},
			new String[] {
				"\u5355\u8BCD", "\u8BCD\u4E49"
			}
		));
		table.getColumnModel().getColumn(0).setPreferredWidth(139);
		table.getColumnModel().getColumn(0).setMinWidth(25);
		table.getColumnModel().getColumn(1).setPreferredWidth(470);
		table.getColumnModel().getColumn(1).setMinWidth(19);
		table.getColumnModel().getColumn(1).setMaxWidth(2147483645);
		scrollPane.setViewportView(table);
		
		this.setLocationRelativeTo(null);
	}
}
